const Sequelize = require('sequelize');
module.exports = function(sequelize, DataTypes) {
  return sequelize.define('as4KDotsEvent', {
    id: {
      autoIncrement: true,
      type: DataTypes.INTEGER,
      allowNull: false,
      primaryKey: true,
      comment: "编号"
    },
    stock_code: {
      type: DataTypes.STRING(10),
      allowNull: true,
      defaultValue: "",
      comment: "代码"
    },
    stock_name: {
      type: DataTypes.STRING(10),
      allowNull: true,
      defaultValue: "",
      comment: "名字"
    },
    event_type: {
      type: DataTypes.STRING(20),
      allowNull: true,
      comment: "事件类型"
    },
    specific_event_type: {
      type: DataTypes.STRING(128),
      allowNull: true,
      comment: "具体类型"
    },
    notice_date: {
      type: DataTypes.STRING(20),
      allowNull: true,
      comment: "持仓数量"
    },
    level1_content: {
      type: DataTypes.STRING(1000),
      allowNull: true,
      comment: "内容1"
    },
    level2_content: {
      type: DataTypes.JSON,
      allowNull: true,
      comment: "内容2"
    },
    create_tie: {
      type: DataTypes.DATE,
      allowNull: true,
      defaultValue: Sequelize.Sequelize.literal('CURRENT_TIMESTAMP'),
      comment: "创建时间"
    },
    update_time: {
      type: DataTypes.DATE,
      allowNull: true,
      defaultValue: Sequelize.Sequelize.literal('CURRENT_TIMESTAMP'),
      comment: "更新时间"
    }
  }, {
    sequelize,
    tableName: 'as4k_dots_event',
    timestamps: false,
    indexes: [
      {
        name: "PRIMARY",
        unique: true,
        using: "BTREE",
        fields: [
          { name: "id" },
        ]
      },
    ]
  });
};
